//
//  UILabel+Extension.swift
//  YHWeibo
//
//  Created by 昱含 on 16/5/23.
//  Copyright © 2016年 YuHan. All rights reserved.
//

import UIKit

extension UILabel {
    
    convenience init(title: String, font: CGFloat, textColor: UIColor, alignment: NSTextAlignment = .Center){
        
        self.init()
        
        text = title
        self.font = UIFont.systemFontOfSize(font)
        self.textColor = textColor
        self.textAlignment = alignment
        if alignment == .Left {
            //设置最大布局宽度
            preferredMaxLayoutWidth = screenWidth - 2 * StatusCellMargin
        }
        self.numberOfLines = 0
        sizeToFit()
        
    }
}